Component: 	TWinImage
Description:	Image control based on TWinControl
Author:		Richard Shotbolt
Email:		100327,2305@compuserve.com
Date:		5 Aug 1996

TWinImage in an image control which shares many of the properties of
TImage, but it is based ultimately on TWinControl instead of 
TGraphicControl. 

Although this means it is heavier on Windows resources, it has the
following advantages over TImage: 

- It can accept all standard Windows messages.
- It can receive focus.
- It can be dragged about at run-time (if Dragging = True).
- It can act as a container for a TMediaPlayer playing AVI files.
- The paint routine uses a persistent bitmap like the VB image control
  This means it updates without flickering, and can be used for simple
  animations.
- The current view can be transferred to the persistent bitmap by
  issuing a CommitDrawing command. Anything subsequently drawn over
  this can be noiselessly erased by an EraseDrawing command.
- MoveTo, LineTo, Rectangle, Circle and TextOut properties use the
  bottom left (NOT top left) corner as the origin. This is to facilitate
  its use in graph controls.

This component is freeware, but as it is part of a commercial product I
am working on it has no SaveToFile or Print methods. But these are not
too difficult to add yourself. 

Any worthwhile additions should be uploaded to this forum. Would somebody
care to add a Transparent property ? 

<< Using TWinImage >>

The easiest way to find out about TWinImage is to drop one on a form
and fiddle with the properties.

TWinImage has the properties, methods and events:

---------------------------------------------------------------------

<< Methods >>

---------------------------------------------------------------------

LoadFromFile (FileName: String)
If (FileName) exists, loads the image as a bitmap.

CommitDrawing
Saves the current view of the image as the persistent bitmap. Anything
you have drawn becomes part of the background.

EraseDrawing
Anything drawn over the background is erased without flicker.

MoveTo(X, Y: Integer)
Uses lower left as origin.

LineTo(X, Y: Integer)
Uses lower left as origin. Draws a line to (X, Y), including the last
pixel, using PenColor.

Clear
Clears any image associated with the control. 

TextOut(X, Y: Integer; Msg: String)
Writes text string to X,Y (origin is bottom left). Attributes are
set by the Font property.

Rectangle(X, Y, W, H: Integer)
Draws a rectangle of width W and height H in the PenColor at X,Y (origin
lower left).

Circle(X, Y, R: Integer)
Draws a circle of radius R in the PenColor at X,Y (origin lower left).

---------------------------------------------------------------------

<< Properties >>

---------------------------------------------------------------------

BackColor: TColor
This is the color that shows through any fill pattern.
 
Border: Boolean
If True, a single black border is drawn.

Dragging: Boolean
If True, the component can be clicked and dragged around at run-time.

FillColor: TColor
This is the color of a fill pattern.

FillStyle: TBrushStyle
The fill style.

PenColor: TColor
Any subsequent drawing is done in this color.

PenStyle: TPenStyle
The pen style.

PenWidth: Integer
The pen width. Default is 1 pixel.

Picture: TBitMap
A bitmap which can be displayed as a background or foreground. It uses
the standard image property editor at design time.

Stretch: Boolean
If True, the control resizes to fit the bitmap. If False, the bitmap
resizes to fit the control.

In addition the properties above, the following are also supported:

Align;
DragCursor;
DragMode;
Enabled;
Font
ParentShowHint;
ShowHint;
Visible;
OnClick;
OnDblClick;
OnDragDrop;
OnDragOver;
OnEndDrag;
OnMouseDown;
OnMouseMove;
OnMouseUp;

It also has all the properties and methods of TCustomControl such as 
Height Width etc.

---------------------------------------------------------------------

<< Installation >>

Backup your 'complib.dcl' file as a precaution.
Select 'Options', 'Install Components'.
Select 'Add', 'Browse'.
Select the directory containing the TWinImage files.
Select 'winimage.pas' and click OK on each box that appears.
The TWinImage control will be added to the 'Samples' section of your
component toolbar.
If anything goes wrong, restore your backed-up complib.dcl and try
again after correcting any obvious problems.
